home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11658 < prev    next >
Encoding:
Text File  |  1996-08-05  |  892 b   |  41 lines

  1. Path: news.mindspring.com!usenet
  2. From: vtipres@atl.mindspring.com (Shon Frazier)
  3. Newsgroups: comp.lang.c
  4. Subject: String Problem
  5. Date: Mon, 25 Mar 1996 17:33:02 GMT
  6. Organization: MindSpring Enterprises, Inc.
  7. Message-ID: <4j6l61$4no@B1FF.mindspring.com>
  8. Reply-To: vtipres@atl.mindspring.com
  9. NNTP-Posting-Host: user-168-121-120-68.dialup.mindspring.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. This is supposed to be a variation on sample code from a textbook.
  13. Can anyone tell me why NameCheck = 0 when I run the program?
  14.  
  15. /*
  16.    Testing character transactions.
  17. */
  18.  
  19. #include <stdio.h>
  20. #include <ctype.h>
  21.  
  22. int main()
  23. {
  24.    char Name[11] = "John";
  25.    char *WhereName;
  26.    int NameCheck = 0;
  27.  
  28.    WhereName = Name;
  29.  
  30.    if ( WhereName == "John" )
  31.    {
  32.       NameCheck = 1;
  33.    }
  34.  
  35.    printf( "Name: %s\n", Name );
  36.    printf( "NameCheck = %i\n", NameCheck );
  37.    printf( "WhereName = %i\n", WhereName );
  38. }
  39.  
  40.  
  41.